import yamail,logging,pytest
def yj(f):
    ya=yamail.SMTP(user='1391277593@qq.com',password='npphtjsegwjqhiae',host='smtp.qq.com')
    ya.send(to='1391277593@qq.com',subject='图书管理系统接口测试报告',contents='请查收',attachments=f)
def log():
    logging.basicConfig(level=logging.ERROR,filename='api_test.log',filemode='w+',format='%(filename)s %(asctime)s %(thread)d %(message)s')
if __name__ == '__main__':
    log()
    pytest.main(['Test_case.py', '-s', '--html=min.html'])
    yj(['api_test.log', 'min.html'])